home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 November: Tool Chest / Dev.CD Nov 98 TC.toast / Sample Code / Snippets / Development Tools & Languages / MouseInfo / UMouseInfo.cp < prev    next >
Encoding:
Text File  |  1995-02-04  |  2.0 KB  |  88 lines  |  [TEXT/MPS ]

  1. //     UMouseInfo.cp 
  2. //     Copyright © 1992 by Apple Computer, Inc. All rights reserved.
  3. //    Kent Sandvik DTS
  4. //    This file contains the basic TMapApplication member functions
  5. //    Version Info (latest first):
  6. //
  7. //    <1>        khs        1.0        First final version
  8. //    <2>        khs        1.0.1    Fixed a memory leak in TMapApplication::GetSleepValue()
  9.  
  10.  
  11. // INCLUDES 
  12.  
  13. #ifndef __UMOUSEINFO__
  14. #include "UMouseInfo.h"                                        // class definitions
  15. #endif
  16.  
  17. extern RgnHandle gtempRgn;
  18.  
  19.  
  20. //    Empty constructor - for avoiding ptabs in global data space
  21. #undef Inherited
  22. #define Inherited TApplication
  23.  
  24. #pragma segment ARes
  25. DefineClass(TMapApplication, Inherited);
  26.  
  27. #pragma segment ARes
  28. TMapApplication::TMapApplication()
  29. {
  30. }
  31.  
  32.  
  33. //    Initialize the Application object
  34. #pragma segment AInit
  35.      void TMapApplication::IMapApplication(OSType fileType,
  36.                                              OSType creator)
  37. {
  38.     Inherited::IApplication(fileType, creator);
  39.  
  40.     macroDontDeadStrip(TAppFrameAdorner);
  41.  
  42.     RegisterStdType("TAppFrameAdorner", 'afra');// register adorner types
  43. }
  44.  
  45.  
  46. //    Create a new TDocument from the class
  47. #pragma segment AOpen
  48.      TDocument* TMapApplication::DoMakeDocument(CommandNumber/* itsCmdNumber */,
  49.                                                   TFile*/* itsFile */ )
  50. {
  51.     TMouseDocument * aMouseDocument = new TMouseDocument;
  52.     aMouseDocument->IMouseDocument();
  53.     return aMouseDocument;
  54. }
  55.  
  56.  
  57. // Show our cute About Box with Jeff trying to destroy my portable at Bahia Honda
  58. #pragma segment AMain
  59.      void TMapApplication::DoAboutBox()
  60. {
  61.     CreateAboutBox();
  62. }
  63.  
  64.  
  65. //    Make sleep region small so we will get more mouse events, make this
  66. //    dynamic so we could turn this on off depending if the mouse tracking behavior is active
  67. #pragma segment MAApplicationRes
  68.      RgnHandle TMapApplication::GetSleepRegion()
  69. {
  70.     if (gMouseTrackWindow)                        // we have a floating window tracking mouse movements -> more events needed
  71.     {
  72.         CPoint mousePoint;
  73.  
  74.         GetMouse(mousePoint);
  75.         SetRectRgn(gtempRgn, mousePoint.v, mousePoint.h, mousePoint.v + 1, mousePoint.h + 1);
  76.  
  77.         return gtempRgn;
  78.     }
  79.     else
  80.         return Inherited::GetSleepRegion();
  81. }
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.